package com.mezo.athena.system.service.impl;

import java.util.List;
import com.mezo.athena.common.utils.DateUtils;
import com.mezo.athena.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mezo.athena.system.mapper.RyBrandMapper;
import com.mezo.athena.system.domain.RyBrand;
import com.mezo.athena.system.service.IRyBrandService;

/**
 * 品牌Service业务层处理
 * 
 * @author athena
 * @date 2024-11-13
 */
@Service
public class RyBrandServiceImpl implements IRyBrandService 
{
    @Autowired
    private RyBrandMapper ryBrandMapper;

    /**
     * 查询品牌
     * 
     * @param id 品牌主键
     * @return 品牌
     */
    @Override
    public RyBrand selectRyBrandById(Long id)
    {
        return ryBrandMapper.selectRyBrandById(id);
    }

    /**
     * 查询品牌列表
     * 
     * @param ryBrand 品牌
     * @return 品牌
     */
    @Override
    public List<RyBrand> selectRyBrandList(RyBrand ryBrand)
    {
        return ryBrandMapper.selectRyBrandList(ryBrand);
    }

    /**
     * 新增品牌
     * 
     * @param ryBrand 品牌
     * @return 结果
     */
    @Override
    public int insertRyBrand(RyBrand ryBrand)
    {
        ryBrand.setCreateBy(SecurityUtils.getUsername());
        ryBrand.setCreateTime(DateUtils.getNowDate());
        ryBrand.setUpdateBy(SecurityUtils.getUsername());
        ryBrand.setUpdateTime(DateUtils.getNowDate());
        return ryBrandMapper.insertRyBrand(ryBrand);
    }

    /**
     * 修改品牌
     * 
     * @param ryBrand 品牌
     * @return 结果
     */
    @Override
    public int updateRyBrand(RyBrand ryBrand)
    {
        ryBrand.setUpdateBy(SecurityUtils.getUsername());
        ryBrand.setUpdateTime(DateUtils.getNowDate());
        return ryBrandMapper.updateRyBrand(ryBrand);
    }

    /**
     * 批量删除品牌
     * 
     * @param ids 需要删除的品牌主键
     * @return 结果
     */
    @Override
    public int deleteRyBrandByIds(Long[] ids)
    {
        return ryBrandMapper.deleteRyBrandByIds(ids);
    }

    /**
     * 删除品牌信息
     * 
     * @param id 品牌主键
     * @return 结果
     */
    @Override
    public int deleteRyBrandById(Long id)
    {
        return ryBrandMapper.deleteRyBrandById(id);
    }
}
